import request from "@/api/request";

/**
 * 搜索页历史记录和热门关键词
 * @returns
 */
function indexaction(data) {
  return request({
    url: "/search/indexaction",
    data,
  });
}
/**
 *搜索关键词商品
 * @param {*} data
 * @returns
 */
function helperaction(data) {
  return request({
    url: "/search/helperaction",
    data,
  });
}

/**
 * 将关键词添加到历史记录
 * @param {*} data
 * @returns
 */
function addhistoryaction(data) {
  return request({
    url: "/search/addhistoryaction",
    method: "POST",
    data,
  });
}

/**
 * 清空历史记录
 * @returns
 */
function clearhistoryAction() {
  return request({
    url: "/search/clearhistoryAction",
    method: "POST",
    data: {
      openId: localStorage.getItem("openId"),
    },
  });
}

export { indexaction, helperaction, addhistoryaction, clearhistoryAction };
